package com.example.zhangxinying.smratchatnew;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by zhangxinying on 16/9/11.
 */
public class SpaceItemDecoration extends RecyclerView.ItemDecoration{
    private int space;
    public SpaceItemDecoration(int space){
        this.space=space;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        outRect.left=space;
        outRect.right=space;
     if (parent.getChildPosition(view)!=0){
         outRect.left=space;
         outRect.right=space;
     }
    }
}
